package com.atguigu.spring.test;

import com.atguigu.spring.aop.annotation.Calculator;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AOPTesr {

    @Test
    public void testAOPBYAnnotation(){
        ApplicationContext ioc = new ClassPathXmlApplicationContext("aop-annotation.xml");
        //直接获取不到代理类的对象，这里获取的是代理对象（向上转型）
        //通过代理对象来执行方法
        Calculator calculator = ioc.getBean(Calculator.class);
        calculator.add(1, 3);
    }
}
